<%@ include file = "/common/ini.jsp"%>
<%@ include file = "/common/_log4j.jsp"%>
<%@ include file = "/common/_ApplicationContext_init.jsp"%>
<%@ include file = "/common/_vr.jsp"%>
<%
    // 定义名称
    String title = "修改人员";
    UserManager userManager = (UserManager)applicationContext.getBean("userManager");
    User user = (User)userManager.get(request.getParameter("id"));
    String remark = "";
%>
<script>
    function submitData()
    {
        this.selectAll(detailForm.postIds);
        detailForm.serviceURL.value = "sysframe.user.UpdateUserService";
        detailForm.submit();
    }
    function reset()
    {
        detailForm.account.disabled = true;
        detailForm.id.value = "<%= user.getId()%>";
        <%
        if(vr.isAllValidated())
        {
            List posts = user.getPosts();
            for(int i = 0; i < posts.size(); i ++)
            {
                Post post = (Post)posts.get(i);
                %>addOption(detailForm.postIds,"<%= post.getId()%>","<%= post.getName()%>");<%
            }// for i
            %>
            detailForm.account.value = "<%= user.getAccount()%>";
            detailForm.familyName.value = "<%= user.getFamilyName()%>";
            detailForm.givenName.value = "<%= user.getGivenName()%>";
            detailForm.birthday.value = "<%= user.getFormatedBirthday()%>";
            detailForm.address.value = "<%= user.getAddress()%>";
            detailForm.email.value = "<%= user.getEmail()%>";
            detailForm.phone.value = "<%= user.getPhone()%>";
            detailForm.homeSite.value = "<%= user.getHomeSite()%>";
            detailForm.mobile.value = "<%= user.getMobile()%>";
            detailForm.pwLimtDate.value = "<%= user.getFormatedPwLimtDate()%>";
            detailForm.idLimtDate.value = "<%= user.getFormatedIdLimtDate()%>";
            detailForm.pwErrorNum.value = "<%= user.getPwErrorNum()%>";
            detailForm.pwErrorLock.value = "<%= user.getPwErrorLock()%>";
            <%
            remark = user.getRemark();
        }
        else
        {
            String[] postIds = request.getParameterValues("postIds");
            if(postIds != null)
            {
                PostManager postManager = (PostManager)applicationContext.getBean("postManager");
                for(int i = 0; i < postIds.length; i ++)
                {
                    Post post = (Post)postManager.get(postIds[i]);
                    %>addOption(detailForm.postIds,"<%= post.getId()%>","<%= post.getName()%>");<%
                }//for i
            }
            %>
            detailForm.account.value = "<%= user.getAccount()%>";
            detailForm.familyName.value = "<%= request.getParameter("familyName")%>";
            detailForm.givenName.value = "<%= request.getParameter("givenName")%>";
            detailForm.birthday.value = "<%= request.getParameter("birthday")%>";
            detailForm.address.value = "<%= request.getParameter("address")%>";
            detailForm.email.value = "<%= request.getParameter("email")%>";
            detailForm.phone.value = "<%= request.getParameter("phone")%>";
            detailForm.homeSite.value = "<%= request.getParameter("homeSite")%>";
            detailForm.mobile.value = "<%= request.getParameter("mobile")%>";
            detailForm.pwLimtDate.value = "<%= request.getParameter("pwLimtDate")%>";
            detailForm.idLimtDate.value = "<%= request.getParameter("idLimtDate")%>";
            detailForm.pwErrorNum.value = "<%= request.getParameter("pwErrorNum")%>";
            detailForm.pwErrorLock.value = "<%= request.getParameter("pwErrorLock")%>";
            <%
        }
        %>
    }

    function bodyLoadJS()
    {
        // 被聚焦的控件
        detailForm.familyName.focus();
    }
</script>
<%@ include file = "/js/_js_for_date_input.jsp"%>
<%@ include file = "/common/detail/_OnForm.jsp"%>
<%@ include file = "_detail.jsp"%>
<%@ include file = "/common/detail/_UnderForm.jsp"%>
